package com.esiea.contactmanager.model;


import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.DateTimeFormat.ISO;


public class Contact {


    private Adress paymentAdress;


    private List<Adress> deliveryAdress = new ArrayList<Adress>();


    private String phoneNumber;

    
    private Boolean active;
    
    
    private int id=-1;


    @DateTimeFormat(iso=ISO.DATE)
    private Date birthDate=new Date(7000260059l);

    
    private String email="";

    
    private String secondName="";


    private String firstName="";
    
    public Contact(){
    	birthDate=new Date(0);
    }
    
    public void addDeliveryAddress(Adress a){
    	//if(!deliveryAdress.contains(a))
    		deliveryAdress.add(a);
    }
    
    public boolean removeDeliveryAddress(Adress a){
    		return deliveryAdress.remove(a);
    }
    
    public void removeDeliveryAddressById(int id){
    	 deliveryAdress.remove(id);
}


	public Adress getPaymentAdress() {
		if(paymentAdress==null)
			return new Adress();
		return paymentAdress;
	}


	public void setPaymentAdress(Adress paymentAdress) {
		this.paymentAdress = paymentAdress;
	}


	public List<Adress> getDeliveryAdress() {
		return deliveryAdress;
	}


	public void setDeliveryAdress(List<Adress> deliveryAdress) {
		this.deliveryAdress = deliveryAdress;
	}


	public String getPhoneNumber() {
		return phoneNumber;
	}


	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}


	public Boolean getActive() {
		return active;
	}


	public void setActive(Boolean active) {
		this.active = active;
	}


	@DateTimeFormat(iso=ISO.DATE)
	public Date getBirthDate() {
		return birthDate;
	}


	public void setBirthDate(Date birthDate) {
		this.birthDate = birthDate;
	}


	public String getEmail() {
		return email;
	}


	public void setEmail(String email) {
		this.email = email;
	}


	public String getSecondName() {
		return secondName;
	}


	public void setSecondName(String secondName) {
		this.secondName = secondName;
	}


	public String getFirstName() {
		return firstName;
	}


	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}


	public int getId() {
		return id;
	}


	public void setId(int id) {
		this.id = id;
	}
}
